﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.SysManage
{
   public class T_PUB_MENU
    {
       private readonly DALL.SysManage.T_PUB_MENU dal=new DALL.SysManage.T_PUB_MENU();
        /// <summary>
        /// 得到用户菜单
        /// </summary>
       public List<Model.SysManage.T_PUB_MENU> GetUserMenuList(string strUserID)
       {
           string strWhere = string.Format("  AND s.USER_ID = '{0}'", strUserID);
           return dal.GetUserMenuList(strWhere);
       }


       /// <summary>
       /// 智能提示菜单名称
       /// </summary>
       /// <returns></returns>
       public DataSet GetMenuName()
       {
           return dal.GetMenuName();
       }

       #region  Method

       /// <summary>
       /// 获得下降所有菜单
       /// </summary>
       /// <param name="strPIPD">父ID</param>
       /// <param name="strNmae">名称</param>
       /// <returns></returns>
       public List<Model.SysManage.T_PUB_MENU> GetnextMenu(string strPIPD, string strNmae)
       {
           StringBuilder strSql = new StringBuilder();
           strSql.Append("  1>0 ");
           if (strPIPD != "" && strPIPD != null)
           {
               strSql.Append(string.Format(" and PARENT_ID='{0}'", strPIPD));
           }
           if (!string.IsNullOrEmpty(strNmae))
           {
               strSql.Append(string.Format(" and MENU_NAME like'%{0}%'", strNmae));
           }
           return GetModelList(strSql.ToString());
       }


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(Model.SysManage.T_PUB_MENU model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Model.SysManage.T_PUB_MENU model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int MENU_ID)
		{
			
			return dal.Delete(MENU_ID);
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Model.SysManage.T_PUB_MENU GetModel(int MENU_ID)
		{
			
			return dal.GetModel(MENU_ID);
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.SysManage.T_PUB_MENU> GetModelList(string strWhere)
        {
            return dal.GetListArray(strWhere);
        }
		#endregion  Method
    }
}
